# $Id: PKGBUILD 179615 2013-03-08 18:57:03Z dreisner $
# Maintainer: Dave Reisner <dreisner@archlinux.org>
# Contributor: Eric Bélanger <eric@archlinux.org>
# Contributor: Aaron Griffin <aaron@archlinux.org>

pkgname=syslog-ng
pkgver=3.4.1
pkgrel=2
pkgdesc="Next-generation syslogd with advanced networking and filtering capabilities"
arch=('i686' 'x86_64')
license=('GPL2')
url="http://www.balabit.com/network-security/syslog-ng/"
depends=('awk' 'eventlog' 'glib2' 'libcap' 'openssl' 'systemd')
makedepends=('flex' 'pkg-config' 'python2')
optdepends=('logrotate: for rotating log files')
options=('!libtool')
backup=('etc/syslog-ng/modules.conf'
        'etc/syslog-ng/scl.conf'
        'etc/syslog-ng/syslog-ng.conf'
        'etc/logrotate.d/syslog-ng')
install=$pkgname.install
source=("http://www.balabit.com/downloads/files/syslog-ng/sources/$pkgver/source/${pkgname}_$pkgver.tar.gz"
        syslog-ng.conf
        syslog-ng.logrotate)
sha1sums=('e75892262863b77f74a401d19661164154f716e7'
          '0aaf695ea6756b59198ff2e4af237b4a6186525d'
          '949128fe3d7f77a7aab99048061f885bc758000c')

build() {
  cd "$pkgname-$pkgver"

  ./configure \
    --prefix=/usr \
    --sysconfdir=/etc/syslog-ng \
    --libexecdir=/usr/lib \
    --localstatedir=/var/lib/syslog-ng \
    --datadir=/usr/share/syslog-ng \
    --with-pidfile-dir=/run \
    --disable-spoof-source \
    --enable-ipv6 \
    --enable-systemd \
    --with-systemdsystemunitdir=/usr/lib/systemd/system

  make
}

package() {
  make -C "$pkgname-$pkgver" DESTDIR="$pkgdir" install

  install -dm755 "$pkgdir/var/lib/syslog-ng" "$pkgdir/etc/syslog-ng/patterndb.d"
  install -Dm644 "$srcdir/syslog-ng.conf" "$pkgdir/etc/syslog-ng/syslog-ng.conf"
  install -Dm644 "$srcdir/syslog-ng.logrotate" "$pkgdir/etc/logrotate.d/syslog-ng"
}
